﻿<%
'函数名称：ReadTextFile
'作用：利用Adodb.Stream对象来读取UTF-8编码的文件
'示例：Call ReadFromTextFile("File/FileName.htm","UTF-8")
Function ReadFromTextFile(FileUrl,CharSet)
 dim str
 set stm=server.CreateObject("adodb.stream")
  stm.Type=2'以本模式读取
  stm.mode=3 
  stm.charset=CharSet
  stm.open
  stm.loadfromfile server.MapPath(FileUrl)
  str=stm.readtext
  stm.Close
 set stm=nothing
 ReadFromTextFile=str
End Function
'函数名称：WriteToTextFile
'作用：利用Adodb.Stream对象来写入UTF-8编码的文件
'示例：Call WriteToTextFile("File/FileName.htm",Content,"UTF-8")
Sub WriteToTextFile(FileUrl,byval Str,CharSet)
 set stm=server.CreateObject("adodb.stream")
  stm.Type=2'以本模式读取
  stm.mode=3
  stm.charset=CharSet
  stm.open
  stm.WriteText str
  stm.SaveToFile server.MapPath(FileUrl),2 
  stm.flush
  stm.Close
 set stm=nothing
End Sub

function adreplace(s)
    if instr(s,"[Show_ad_top]") then
    s=replace(s,"[Show_ad_top]",ReadFromTextFile("../AD/top_ad.htm","utf-8"))
    end if 

    if instr(s,"[Show_ad_comic_r1]") then
    s=replace(s,"[Show_ad_comic_r1]",ReadFromTextFile("../AD/comic_250_250.htm","utf-8"))
    end if 

    if instr(s,"[Show_ad_comic_r2]") then
    s=replace(s,"[Show_ad_comic_r2]",ReadFromTextFile("../AD/comic_760_1.htm","utf-8"))
    end if 

    if instr(s,"[Show_ad_comic_r3]") then
    s=replace(s,"[Show_ad_comic_r3]",ReadFromTextFile("../AD/comic_760_2.htm","utf-8"))
    end if 

    if instr(s,"[Show_ad_comic_left]") then
    s=replace(s,"[Show_ad_comic_left]",ReadFromTextFile("../AD/comic_160_600.htm","utf-8"))
    end if 

    if instr(s,"[Show_ad_right]") then
    s=replace(s,"[Show_ad_right]",ReadFromTextFile("../AD/comic_200_200.htm","utf-8"))
    end if

    if instr(s,"[Show_ad_list_top]") then
    s=replace(s,"[Show_ad_list_top]",ReadFromTextFile("../AD/list_top.htm","utf-8"))
    end if 

    if instr(s,"[Show_ad_show_1]") then
    s=replace(s,"[Show_ad_show_1]",ReadFromTextFile("../AD/show_1.htm","utf-8"))
    end if 

    if instr(s,"[Show_ad_show_2]") then
    s=replace(s,"[Show_ad_show_2]",ReadFromTextFile("../AD/show_2.htm","utf-8"))
    end if 

    if instr(s,"[Show_ad_show_3]") then
    s=replace(s,"[Show_ad_show_3]",ReadFromTextFile("../AD/show_3.htm","utf-8"))
    end if 

adreplace=s 
end function


function commonreplace(s)
    if instr(s,"[Page_common_top_nav]") then
    s=replace(s,"[Page_common_top_nav]",ReadFromTextFile("temp/common/top-nav.htm","utf-8"))
    end if 

    if instr(s,"[Page_common_top_main]") then
    s=replace(s,"[Page_common_top_main]",ReadFromTextFile("temp/common/top-main.htm","utf-8"))
    end if 

    if instr(s,"[Page_common_foot]") then
    s=replace(s,"[Page_common_foot]",ReadFromTextFile("temp/common/foot.htm","utf-8"))
    end if 

commonreplace=s 
end function


function bqtf(s) 
if s<>"" then
s=replace(s,"'","''") 
end if
bqtf=s 
end function
 
function bqtf1(s)
if s<>"" then
s=replace(s,"''","'") 
end if
bqtf1=s 
end function 
function Checkin(s) 
s=trim(s) 
s=replace(s," ","&amp;nbsp;") 
s=replace(s,"'","&amp;#39;") 
s=replace(s,"""","&amp;quot;") 
s=replace(s,"&lt;","&amp;lt;") 
s=replace(s,"&gt;","&amp;gt;") 
Checkin=s 
end function 
function CheckAdmin
	if request.cookies("comicsadmin")("Adminname")="" then response.redirect "index.htm"
end function
sub error()
%>
<html>
<head>
    <link href="images/style.css" type="text/css" rel="stylesheet">
    <title>出错</title>
</head>
<body leftmargin="0">
    <div align="center">
        <center>
            <p>
                &nbsp;</p>
            <p>
                &nbsp;</p>
            <p>
                &nbsp;</p>
            <p>
                &nbsp;</p>
            <table width="60%" border="0" cellspacing="5" bgcolor="e7e7e7">
                <tr>
                    <td width="100%">
                        <div align="center">
                            <table width="100%" border="0" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF">
                                <tr>
                                    <td width="100%" bgcolor="f7f7f7" height="80" align="center">
                                        <b><font color="#FF0000">提示</font><font color="#FF0000">：</font><font color="#FF0000"><%=errmsg%>！
                                        </font></b>
                                        <p>
                                            <b><a href="javascript:history.go(-1)"><font color="#FF0000">返 回</font></a></b>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </td>
                </tr>
            </table>
        </center>
    </div>
</body>
</html>
<%
end sub

%>